package com.stone.daoimpl;
import com.stone.dao.IProviderStoneDao;
import com.stone.dao.hibernatebaseimpl.BaseDaoHibernateImpl;
import com.stone.model.Provider;
import com.stone.model.ProviderStone;
import com.stone.utils.Page;

public class ProviderStoneDao extends BaseDaoHibernateImpl<ProviderStone, Long> implements IProviderStoneDao {

	public Page findAllPrividerStoneByProviderIdByPage(Provider provider,
			int pageNo, int pageSize) {
		String queryString = "from ProviderStone providerstone where providerstone.provider= ?  order by providerstone.id desc";
		return this.findByQueryString4Page(queryString, new Object[]{provider}, pageNo, pageSize);
	}
	
	public Page findAllDisplayProviderStonesByProviderIdByPage(Provider provider, int pageNo, int pageSize)
	{
		String queryString = "select providerstone from ProviderStone providerstone, Stone stone where providerstone.provider= ? "
							+ "and providerstone.stone = stone "
							+ "and (stone.displayFlag is null "
							+ "or stone.displayFlag = 1) "
							+ "order by providerstone.id desc";
		return this.findByQueryString4Page(queryString, new Object[]{provider}, pageNo, pageSize);
	}
}
